<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <title>爱阅读</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

    <meta name="format-detection" content="telephone=no, address=no">
    <meta name="apple-mobile-web-app-capable" content="yes" /> <!-- apple devices fullscreen -->
    <meta name="apple-touch-fullscreen" content="yes"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
    <meta name="keywords" content="微直达" />
    <meta name="description" content="微直达: 直达天下，瞬息联通。" />

    <!-- Bootstrap -->
    <link href="../resource/css/common.css" rel="stylesheet">
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js does not work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" href="../style/common.css">
    <script src="//res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
    <script src="../../app/js/common.js"></script>
</head>
<body>
<style>
    .LoveRead{ padding:48px 16px 0; }
    .LoveRead a{ text-decoration:none; }
    .LoveRead .LoveRead_time{ width:100%; overflow:hidden; margin:16px 0; text-align:center; }
    .LoveRead .LoveRead_time div{ padding:4px 8px; font-size:80%; background-color:#CECECE; color:#FFF; margin:auto; display:inline-block; border-radius:3px; }
    .LoveRead dl{ background-color:#FFF; border-radius:4px; box-shadow:0px 0px 2px #999; }
    .LoveRead dt{ padding:8px; overflow:hidden; height:158px; }
    .LoveRead dt .img{width:100%; height:158px; position:relative; overflow:hidden;border-style:none;border-width:0; }
    .LoveRead dt .img div{ background:url(../style/black_1px.png); position:absolute; left:0; bottom:0; width:100%; }
    .LoveRead dt .img div h1{ margin:8px; color:#FFF; font-weight:normal; font-size:120%; text-align:left; }
    .LoveRead dd{ border-top:1px solid #eee; overflow:hidden; padding:8px 8px 8px; }
    .LoveRead dd table{ border:none; width:100%; }
    .LoveRead dd td{ border:none; color:#333; }
    .LoveRead dd td a {color:#333; }
    .LoveRead dd .LRtxt{ font-size:100%; line-height:180%; vertical-align:middle; }
    .LoveRead dd .img{ width:40px; height:40px; overflow:hidden; float:right; margin-left:8px; border-style:none;border-width:0;}
    .bottom{height:64px;width:100%;text-align:center;overflow:hidden;line-height:32px;}
    .bottom_word{width:100%;height:64px;line-height:64px;color:#666;font-size:90%;text-align:center;}
    .pageend,.pageloading{display: none;}
</style>

<?php
/**
 * Created by PhpStorm. User: 张书博, Date: 16-04-21 下午18:30
 * Description:
 */
$sql = "select id,date_format(添加时间,'%Y-%m-%d') as 添加时间 from 咨询信息 where 发送='已发送' order by id desc  limit 0,10";
$res = pdo()->selectAll($sql);
foreach($res as $key => $item){
    $sql = "select * from 咨询详情 where 咨询id=".$item['id']." order by 排序 asc";
    $res[$key]['item'] =  pdo()->selectAll($sql);
}

require_once __DIR__ . '/jssdk.php';
$数据 = pdo()->selectColumns('public_serv_accounts',array('AppSecret','app_id'),array('id' => G_SERV_ID));
$jssdk = new JSSDK($数据['app_id'], $数据['AppSecret']);
$signPackage = $jssdk->getSignPackage();
?>

<div class="header" style="z-index:9999;"><div class="header_logo"><img src="../style/logo_small.png" /><h1>爱阅读</h1></div></div><!--改-->
<div class="LoveRead">
    <?php
        foreach($res as $k => $v){
             ?>
            <div class="LoveRead_time"><div><?=$v['添加时间']?></div></div>
                 <dl>
                     <?php
                     foreach($v['item'] as $key => $val){
                        if($key == 0){
                           ?>
                            <a href="<?=$val['文章url']?>">
                                <dt>
                                <div class="img" style="background:url(<?=$val['图片url']?>) no-repeat center;background-size:cover; "><div><h1><?=$val['标题']?></h1></div></div>
                                </dt>
                            </a>
                            <?php
                        }else{
                            ?>
                            <a href="<?=$val['文章url']?>">
                            <dd>
                                <table>
                                    <tr>

                                        <td class="LRtxt"><?=$val['标题']?></td>

                                        <td><div class="img" style="background:url(<?=$val['图片url']?>) no-repeat center;background-size:cover; "></div></td>
                                    </tr>
                                </table>
                            </dd>
                            </a>
                            <?php

                        }
                     }
                     ?>
                 </dl>
             <?php
        }
    ?>


</div>
<div class="bottom  pageloading"><div class="bottom_word" >正在加载...</div></div>
<div class="bottom  pageend"><div class="bottom_wordd" >加载完毕</div></div>

<script src="../resource/js/jquery-1.11.1.min.js"></script>
<script>
    var page=1;
    var end = false;
    var timer = null;
    $(document).ready(function() {
        $(window).scroll(function() {
            if(end == true){
                return false;
            }
            clearTimeout(timer);
            timer = setTimeout(
                function(){
                    if (($(document).scrollTop() >= $(document).height() - $(window).height()-100)){
                        $.ajax({
                            url:"Ajax.php?a=newsHistory",
                            type:'post',
                            data:{page:page},
                            beforeSend: function () {
                                $(".pageloading").show();
                            },
                            success:function(data){
                                if(data == 'zero'){
                                    end = true;
                                    $(".pageloading").hide();
                                    $(".pageend").show();
                                }else{
                                    $(".LoveRead").append(data);
                                    $(".pageloading").hide();
                                    page++;
                                }

                            }

                        })
                    }
                },200
            );

        });
    });

    wx.config({
        debug: false,
        appId: '<?php echo $signPackage["appId"];?>',
        timestamp: <?php echo $signPackage["timestamp"];?>,
        nonceStr: '<?php echo $signPackage["nonceStr"];?>',
        signature: '<?php echo $signPackage["signature"];?>',
        jsApiList: [
            'onMenuShareAppMessage',
            'onMenuShareTimeline',
            'onMenuShareQQ',
            'onMenuShareWeibo',
            'onMenuShareQZone'
        ]
    });

    title = '爱阅读-儿科资讯早知道';
    desc = '爱贝儿医—专注于做儿科医生间学习工作交流平台。平台拥有数十位来自省级以上重点三甲医院的儿科专家、重点医院儿科学科带头人、国内儿科权威人士组成的豪华专家团队。';
    links = '';
    imgUrl = '<?= G_SITE_BASE ?>/business/img/logoRed2.png';
    weixinShare(title, desc, links, imgUrl);


</script>

</body>
</html>